package com.gimi.cloud.bbp.manage.controller.page;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gimi.cloud.bbp.common.enums.ResponseCodeEnum;
import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.dto.page.PageTemplateDTO;
import com.gimi.cloud.bbp.manage.service.page.PageTemplateService;

@RestController
public class PageTemplateController {
	
	@Autowired private PageTemplateService pageTemplateService;
	
	@RequestMapping("/pc/getPageTemplateList")
	public Response getList(@RequestBody PageTemplateDTO dto, HttpServletResponse response) {
		return new Response(ResponseCodeEnum.SUCCESSED, pageTemplateService.getList(dto));
	}
	
	@RequestMapping("/pc/delPageTemplate")
	public Response delInfo(@RequestBody PageTemplateDTO dto, HttpServletResponse response) {
		return new Response(ResponseCodeEnum.SUCCESSED);
	}
	
	@RequestMapping("/pc/savePageTemplate")
	public Response saveInfo(@RequestBody PageTemplateDTO dto, HttpServletResponse response) {
		pageTemplateService.saveInfo(dto);
		return new Response(ResponseCodeEnum.SUCCESSED);
	}
	
	@RequestMapping("/pc/getPageTemplate")
	public Response getInfo(@RequestBody PageTemplateDTO dto, HttpServletResponse response) {
		return new Response(ResponseCodeEnum.SUCCESSED,pageTemplateService.getInfoById(dto.getId()));
	}
	
}
